home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
X User Tools
/
X User Tools (O'Reilly and Associates)(1994).ISO
/
sun4c
/
archive
/
tcltk.z
/
tcltk
/
man
/
cat3
/
Name.3
< prev
next >
Wrap
Text File
|
1994-09-20
|
4KB
|
133 lines
Tk_Name(3) Tk Library Procedures
_________________________________________________________________
NAME
Tk_Name, Tk_PathName, Tk_NameToWindow - convert between
names and window tokens
SYNOPSIS
#include <tk.h>
Tk_Uid
Tk_Name(_t_k_w_i_n)
char *
Tk_PathName(_t_k_w_i_n)
Tk_Window
Tk_NameToWindow(_i_n_t_e_r_p, _p_a_t_h_N_a_m_e, _t_k_w_i_n)
ARGUMENTS
Tk_Window _t_k_w_i_n (in) Token for window.
Tcl_Interp *_i_n_t_e_r_p (out) Interpreter to use for
error reporting.
char *_p_a_t_h_N_a_m_e (in) Character string contain-
ing path name of window.
_________________________________________________________________
DESCRIPTION
Each window managed by Tk has two names, a short name that
identifies a window among children of the same parent, and a
path name that identifies the window uniquely among all the
windows belonging to the same main window. The path name is
used more often in Tk than the short name; many commands,
like bind, expect path names as arguments.
The Tk_Name macro returns a window's short name, which is
the same as the _n_a_m_e argument passed to Tk_CreateMainWindow
or Tk_CreateTopLevelWindow or Tk_CreateChildWindow when the
window was created. The value is returned as a Tk_Uid,
which may be used just like a string pointer but also has
the properties of a unique identfier (see the manual entry
for Tk_GetUid for details).
The Tk_PathName macro returns a hierarchical name for _t_k_w_i_n.
Path names have a structure similar to file names in Unix
but with dots between elements instead of slashes: the main
window for an application (one created by calling
Tk_CreateMainWindow or by calling Tk_CreateTopLevelWindow
with a NULL _p_a_r_e_n_t argument) has the path name ``.''; its
children have names like ``.a'' and ``.b''; their children
Tk 1
Tk_Name(3) Tk Library Procedures
have names like ``.a.aa'' and ``.b.bb''; and so on. A win-
dow is considered to be be a child of another window for
naming purposes if the second window was named as the first
window's _p_a_r_e_n_t when the first window was created. This is
not always the same as the X window hierarchy. For example,
a pop-up is created as a child of the root window, but its
logical parent will usually be a window within the applica-
tion.
The procedure Tk_NameToWindow returns the token for a window
given its path name (the _p_a_t_h_N_a_m_e argument) and another win-
dow belonging to the same main window (_t_k_w_i_n). It normally
returns a token for the named window, but if no such window
exists Tk_NameToWindow leaves an error message in _i_n_t_e_r_p-
>_r_e_s_u_l_t and returns NULL. The _t_k_w_i_n argument to
Tk_NameToWindow is needed because path names are only unique
within a single application hierarchy. If, for example, a
single process has opened two main windows, each will have a
separate naming hierarchy and the same path name might
appear in each of the hierarchies. Normally _t_k_w_i_n is the
main window of the desired hierarchy, but this need not be
the case: any window in the desired hierarchy may be used.
KEYWORDS
name, path name, token, window
Tk 2